package Lee_code;

/**
 * @author blh
 * @date 2024年08月02日 18:24
 */
public class Lee_222_82 {
    int count = 0;
    public int countNodes(TreeNode root) {
        dfs(root);
        return count;
    }

    private void dfs(TreeNode root) {
        if (root == null){
            return;
        }
        count++;
        dfs(root.left);
        dfs(root.right);
    }
}
